import request from '@/utils/request.js'
import {useTokenStore} from '@/stores/token.js'
//图书列表查询
export const bookListService = (params) => {
    //const tokenStore = useTokenStore();
    //在pinia中定义的响应式数据,都不需要.value
    //return request.get('/category',{headers:{'Authorization':tokenStore.token}})
    return request.get('/books/page',{ params: params })
}

//图书添加
export const bookAddService = (bookData) => {
    return request.post('/books', bookData)
}

//图书修改
export const bookUpdateService = (bookId,params) => {
    return request.put(`/books/${bookId}`,params)
}

//图书删除
export const bookDeleteService = (bookId) => {
    return request.delete('/books/' + bookId)
}

//借阅人列表查询
export const recordsListService = (params) => {
    return request.get('/records/page',{ params: params })
}

//借阅人添加
export const recordsAddService = (recordData) => {
    return request.post('/records', recordData);
}

//借阅人修改
export const recordsUpdateService = (recordData) => {
    return request.put(`/records`,recordData)
}

//借阅人删除
export const recordsDeleteService = (recordId) => {
    return request.delete('/records/' + recordId)
}

